test(coordination): align claim contention recovery - #5444
huangruiteng merged 1 commit into
Conversation
Signed-off-by: duanjialing.777 <duanjialing.777@bytedance.com>
|
Exact-head CI attribution for
Keep the fixes isolated: land/sync #5442 rather than adding its cleanup change to this PR. Remaining matrix jobs are still running. No merge action was taken. |
huangruiteng
left a comment
There was a problem hiding this comment.
动机
未发现阻塞问题。评审 exact head:ef2d1ce649a33b1ac6c92acad890c119aee1a185。本 PR 修正已经过时的 receipt-only claim 测试预期,而不是把一次失败改成任意成功:当前生产实现会在未指定 revision 的 CAS 竞争后重新加载并验证 owner;当另一 Agent 赢得 claim,应该明确拒绝原调用方,不能只返回底层 conflict。旧测试的共同 changed=false 断言先失败,掩盖了这个语义分支。
改动思路
继续使用现有真实 FileAuthorityStore 和 FaultStore 注入点。conflict 路径先让 agent-b 持久化占有,然后 agent-a 重新验证并返回 claim_owner_mismatch,不能留下 no-change 成功回执;lost_response 路径则已实际提交,必须从 durable receipt 恢复,不得再次改变 authority。测试把两种不同结果分开,保持 receipt 与 canonical owner 的后续断言。
具体改动
关键代码讲解
receipt-only claims revalidate CAS contention and recover a lost commit response(tests/control_plane_ts/local_authority_runtime.test.ts:1305):只改测试名和分支断言,conflict 检查 failed + claim_owner_mismatch,lost_response 保持 changed=false + recovered;并继续检验回执是否存在以及 canonical owner 是否被不当改写。executeCoordinationTodoClaim(loopx/control_plane/coordination/todo_claim.ts):已存在的共同决策 owner。只对明确未提交、未 pinned 的 CAS conflict 有界重试,每次从新 authority 重新判断 ownership;revision-pinned/transfer-grant 不隐式重试。模糊的提交响应按持久回执恢复。这段生产代码没有被本 PR 改动。claimLocalCoordinationTodo/FaultStore.commitOperation:前者把本地事实送到共同 owner,后者仅在隔离临时 store 注入另一赢家或已提交后丢失响应;不是通过 mock result 直接制造预期。
独立验证:在 immutable base 0cbeda380babc623502c2549817c78d42db947c0 和本 head 运行同一命令 node --experimental-strip-types --test --test-name-pattern 'receipt-only claims' tests/control_plane_ts/local_authority_runtime.test.ts。base 的旧 changed=false 断言失败;head 通过。head 完整 uv run --extra test node --experimental-strip-types --test tests/control_plane_ts/local_authority_runtime.test.ts 为 35 passed / 0 failed,npm run typecheck:control-plane 和 diff whitespace 均通过。底层临时 File store 是真实持久化路径;没有操作活跃 Goal,也没有把它当作 PostgreSQL 资格验证。
对主干的风险
变更只有一个测试文件 +8/-3,没有新生产状态、权限、协议或 UI。最需要避免的是削弱 owner/lease/CAS 拒绝;完整套件保留其他 foreign-owner、pinned-revision、transfer 和 lost-response 负例,并未删掉后续持久化断言。此前评论提及的 Windows teardown 不属于这次断言改动;本次 macOS 验证不声称复现 Windows 原始故障,未读取远端 CI。
扫描现有 claim-owner 测试、base/head/main 和作者近 30 个 PR,未见相同修复已交付或重复新增烟测。这个修改让既有持续使用的回归测试准确区分语义拒绝和已提交恢复,具有维护价值。相邻有界重构已审视:现有 typed TS owner 和 FaultStore seam 足够,不需要为几行断言再增加框架或第二个决策源。前端/Lark/CLI 生产路径没有差异,无 companion 改动要求。
我的整体评价
APPROVE:这个完整的测试维护切片改善持续验证的可用性,同时保持生产用户体验和 authority 规则不变。它不是 whole-Goal、Windows 或 merge readiness 的验收。批准后按 capability 读取旧阻塞评审,仅在逐项验证已解决且具备权限时撤销;不合并。
English verdict: APPROVE - ef2d1ce: The test now distinguishes revalidated ownership rejection from durable lost-response recovery. The identical base selector fails at the obsolete assertion; the current complete 35-test native suite, TypeScript check and whitespace check pass. Production policy is unchanged.
What changed
changed=falseand durable receipt recovery.Why
#5371 made canonical claims reread and revalidate authority after conclusive CAS contention. The older fixture still expected the first provider conflict to escape unchanged. It now fails deterministically because the retry observes
agent-bas the current owner and returnsclaim_owner_mismatch. This surfaced in #5442 typescript-core (1/3).This PR changes only the stale test contract. It does not modify the claim implementation or #5442.
Validation
local_authority_runtime.test.ts: 35/35 passed.npm run typecheck:control-plane: passed.git diff --check: passed.Signed-off commit:
ef2d1ce64.